/*
 * Copyright (c) JoinQuant Development Team
 * Author: Huayong Kuang <kuanghuayong@joinquant.com>
 */

#include "pimpl.h"
#include <iostream>

using namespace std;

class MyClass::impl {
public:
    void func1();
    void func2();

private:
    void func3();
    void func4();

    int a;
    int b;
};

void MyClass::impl::func1() {
    cout << "impl func1" << endl;
    a = 1;
    func3();
}

void MyClass::impl::func2() {
    cout << "impl func2" << endl;
    b = 2;
    func4();
}

void MyClass::impl::func3() {
    cout << "impl func1" << endl;
    cout << "a: " << a << endl;
}

void MyClass::impl::func4() {
    cout << "impl func1" << endl;
    cout << "b: " << b << endl;
}

MyClass::MyClass(){
    pimpl = new impl;
}

void MyClass::func1() {
    pimpl->func1();
}

void MyClass::func2() {
    pimpl->func2();
}

int main(void)
{
    MyClass c;
    c.func1();
    c.func2();

    return 0;
}
